package 代理模式;

import java.util.HashMap;
import java.util.Map;

public class Proxy implements Company {

    private HR hr;

    public Proxy() {
        this.hr = new HR();
    }

    //需要代理的方法
    public void findWorker(String title) {
        hr.findWorker(title);
        //通过猎头挑选候选人
        String worker = getWorker(title);
        System.out.println(title+"挑选候选人为"+worker);
    }

    private String getWorker(String title){
        Map<String,String> workerList = new HashMap<String, String>(){
            {put("JAVA","张三");put("PHP","李四");put("PYTHON","王五");}
        };
        return workerList.get(title);
    }
}
